home *** CD-ROM | disk | FTP | other *** search
File List | 1994-06-12 | 798 b | 68 lines |
- Listing 1 - Objective-C
-
- /* Entry Object */
-
- #import <Object.h>
-
- @interface Entry : Object
- {
- double amount;
- id acct;
- }
-
- + new;
-
-
- -setAmount:(double)theAmt;
- -(double)getAmount;
- -postEntry;
- .
- .
- @end
-
- /* Entry Object */
-
- #import <Entry.h>
-
- @implementation Entry
-
- + new
- {
- [super new];
- }
- -init;
- {
- acct = [Account new];
- }
- -setAmount:(double)theAmt
- {
- amount = theAmt;
- }
- -(double)getAmount
- {
- return amount;
- }
- -postEntry
- {
- [acct debitBalance:amount]; //subtract
- }
- .
- @end
-
- /* main */
-
- #import <Entry.h>
-
- main(void)
- {
- id Check;
-
- Check = [Entry new];
- [Check setAmount: 12.56];
- [Check setPayee: "MediaScape"];
- [Check postEntry]; // [Account postEntry: check];
- .
- [Check storeOn: "Entry.io"];
-
- }
-